package com.edu.whty.service;

import com.edu.whty.entity.cloud.Chapter;
import com.edu.whty.entity.usertextbook.TbUserTextbookChapter;
import com.edu.whty.entity.usertextbook.TbUserTextbookCmsDir;
import com.edu.whty.entity.usertextbook.UserTextBook;

import java.util.List;
import java.util.Map;

public interface UserTextBookService {

    /**
	 * 获取关注教材列表
	 * @param userId
	 * @param platformCode
	 * @return
	 * @throws Exception
	 */
    List<UserTextBook> listUserTextBookByUserId(UserTextBook userTextBook) throws Exception;

    /**
	 * 教材是否添加
	 * @param param
	 * @return
	 * @throws Exception
	 */
	boolean isAdd(UserTextBook userTextBook) throws Exception;

	/**
	 * 新增关注教材
	 * @param book
	 * @throws Exception
	 */
	UserTextBook saveTextBook(UserTextBook userTextBook) throws  Exception;

	/**
	 * 添加自定义教材
	 * @param userId
	 * @param textBookId
	 * @throws Exception
	 */
	void addCmsChapter(TbUserTextbookCmsDir textBookDir) throws Exception;

	/**
	 * 根据ID获取UserTextBook
	 * @param id
	 * @return
	 * @throws Exception
	 */
	UserTextBook loadUserTextBook(String id) throws Exception;

	/**
	 * 删除关注教材
	 * @param userId
	 * @param textBookId
	 * @throws Exception
	 */
	void delteTextBookById(String id) throws Exception;

	/**
	 * 查询教材章节
	 * @param param
	 * @return
	 * @throws Exception
	 */
	List<TbUserTextbookChapter> loadUserTextBookChapter(Map<String, Object> param) throws Exception;

	/**
	 * 批量新增教材
	 * @param List
	 * @throws Exception
	 */
	void saveTextBookBatch(List<UserTextBook> list) throws  Exception;

	/**
	 * 批量新增教材章节
	 * @param List
	 * @throws Exception
	 */
	void saveTextBookChapterBatch(List<TbUserTextbookChapter> list) throws  Exception;

	/**
	 * 批量同步教材
	 * @param List
	 * @throws Exception
	 */
	void syncUserTextBookBatch(List<Map<String, Object>> list, String type);

	/**
	 * 批量同步教材
	 * @param List
	 * @throws Exception
	 */
	void syncSaveOrUpdateBatch(List<Map<String, Object>> list);

	/**
	 * 批量同步教材章节
	 * @param List
	 * @throws Exception
	 */
	void syncUserTextBookChapterBatch(List<Map<String, Object>> list, String type);

	/**
	 * 获取待上行同步的教材列表
	 * @throws Exception
	 */
    List<Map<String, Object>> getUpSyncUserTextBook() throws Exception;

    /**
	 * 更新待同步教材列表为已同步
	 * @throws Exception
	 */
    void finishUpSyncUserTextBook() throws Exception;

	/**
	 * 比对同步教材
	 * @throws Exception
	 */
	void compareSyncUserTextBook(List<String> userIdList, List<UserTextBook> list) throws Exception;

	List<Chapter> selectSubTreeList(Chapter model) throws Exception;


}
